package com.ncu.weatherchina;

import android.content.Context;
import android.graphics.Typeface;
import android.widget.TextView;

public class Util {
    public static void setWeatherIcon(Context context, String type, TextView tv){
        Typeface weatherFont=Typeface.createFromAsset(context.getAssets(),"font/weather.ttf");
        tv.setTypeface(weatherFont);
        String icon="";
        if (type!=null){
            if (type.trim().equals("晴")){
                icon=context.getString(R.string.wi_day_sunny);
            }
            if (type.trim().equals("多云")){
                icon=context.getString(R.string.wi_day_cloudy);
            }
            if (type.trim().equals("阴")){
                icon=context.getString(R.string.wi_cloud);
            }
            if (type.trim().equals("小雨")){
                icon=context.getString(R.string.wi_raindrops);
            }
            if (type.trim().equals("雷阵雨")){
                icon=context.getString(R.string.wi_day_thunderstorm);
            }
            if (type.trim().equals("中雨")){
                icon=context.getString(R.string.wi_day_rain_mix);
            }
            if (type.trim().equals("大雨")){
                icon=context.getString(R.string.wi_rain);
            }
            if (type.trim().equals("暴雨")){
                icon=context.getString(R.string.wi_thunderstorm);
            }
        }
        tv.setText(icon);
    }
}
